<template>
  <div class="logCenter">
    <el-breadcrumb>
      <el-breadcrumb-item>单位及房价管理</el-breadcrumb-item>
      <el-breadcrumb-item>协议单位管理</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="tabs">
      <el-tabs v-model="activeName">
        <el-tab-pane label="协议单位管理"
          name="first"
          v-if="isHas('protocol','first')">
          <AgreementUnit/>
        </el-tab-pane>
        <el-tab-pane label="配置信息"
          name="second"
          v-if="isHas('protocol','second')">
        <ConfigInfo/>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
import ConfigInfo from './configInfo.vue'
import AgreementUnit from './agreementUnit'
import { has } from "@/public/js/util";

export default {
  components: {
    ConfigInfo,
    AgreementUnit
  },
  data() {
    return {
      activeName: "first",
      isFirst: true
    };
  },
  methods: {
    isHas(role, tab) {
      if (this.isFirst) {
        if (has(role, this)) {
          this.activeName = tab;
          this.isFirst = false;
        }
      }
      return has(role, this);
    }
  }
};
</script>
<style lang="scss" scoped>
.logCenter {
  .tabs {
    margin-top: 20px;
    background-color: white;
    padding: 20px 30px;
    position: relative;
  }
}
</style>